<?php
	/*
	 * Author: Avik Kundu
	 * Created On : 24/06/2011
	 * Purpose: Clicking on the Trigger Mail button in this page id will be taken and email will be sent. 
	 */	

	include_once '../conf/db-config.php';
	include_once '../conf/error.php';
	include_once '../submitemail.php';
	include_once '../clsFetchData.php';
	
	$triggered_id = $_REQUEST['trigger_id'];
	$additionalEmailId = $_REQUEST['additionalEmailId'];
	$admin_mail_id = "listings@globaltodo.com";
	$objFetchData = new clsFetchData();
	$arrDataToShow = $objFetchData->getAllDataForId($triggered_id);	
	$category = stripslashes($arrDataToShow['theme']);
	$businessTitle = stripslashes($arrDataToShow['business_title']);
	$business_desc = stripslashes($arrDataToShow['business_desc']);	
	$business_summary = stripslashes($arrDataToShow['business_summary']);					
	$phone_number = $arrDataToShow['phone_number'];
	$city = $arrDataToShow['city'];
	$state = $arrDataToShow['state'];
	$zipCode = $arrDataToShow['zipcode'];
	$streetAddress = stripslashes($arrDataToShow['street_address']);
	$emailId = $arrDataToShow['email_address'];
	$websiteAddress = $arrDataToShow['website_address'];
	$audioUrl = $arrDataToShow['audio_url'];
	$videoUrl = $arrDataToShow['video_url'];
	$salesRepresentatives = stripslashes($arrDataToShow['sales_rep']);
	$tollfree = $arrDataToShow['tollfree_number'];
	$fax = $arrDataToShow['fax_number'];
	$logo = $arrDataToShow['business_logo'];
	$image_1 =  $arrDataToShow['image_1'];
	$image_2 =  $arrDataToShow['image_2'];
	$image_3 =  $arrDataToShow['image_3'];
	$image_4 =  $arrDataToShow['image_4'];
	$barcodeImage = $arrDataToShow['barcode_image'];
	$message="";
	$message .="<h3>Following Listing has been approved.</h3>";
	$message .="<br /><br />";
	$message .="<b>Business Title :</b> $businessTitle"; 
	if(strlen($category)>0)
	{
		$message .="<br />";
		$message .="<b>Category :</b> $category";
	}
	if(strlen($business_desc)>0)
	{
		$message .="<br />";
		$message .="<b>Business Desc :</b> $business_desc";
	}
	if(strlen($business_summary)>0)
	{
		$message .="<br />";
		$message .="<b>Business Summary :</b> $business_summary";
	}
	if(strlen($phone_number)>0)
	{
		$message .="<br />";
		$message .="<b>Phone Number :</b> $phone_number";
	}
	if(strlen($tollfree)>0)
	{
		$message .="<br />";
		$message .="<b>Toll Free Number:</b> $tollfree";
	}
	if(strlen($fax)>0)
	{
		$message .="<br />";
		$message .="<b>Fax Number:</b> $fax";
	}
	if(strlen($streetAddress)>0)
	{
		$message .="<br />";
		$message .="<b>Street Address :</b> $streetAddress";
	}
	if(strlen($city)>0)
	{
		$message .="<br />";
		$message .="<b>City :</b> $city";
	}
	if(strlen($state)>0)
	{
		$message .="<br />";
		$message .="<b>State :</b> $state";
	}
	if(strlen($zipCode)>0)
	{
		$message .="<br />";
		$message .="<b>Zipcode :</b> $zipCode";
	}
	if(strlen($emailId)>0)
	{
		$message .="<br />";
		$message .="<b>Email Id:</b> $emailId";
	}
	if(strlen($websiteAddress)>0)
	{
		$message .="<br />";
		$message .="<b>Website Address :</b> <a href='$websiteAddress' >$websiteAddress</a>";
	}
	if(strlen($audioUrl)>0)
	{
		$message .="<br />";
		$message .="<b>Audio URL:</b> $audioUrl";
	}
	if(strlen($videoUrl)>0)
	{
		$message .="<br />";
		$message .="<b>Video URL:</b> $videoUrl";
	}
	if(strlen($salesRepresentatives)>0)
	{
		$message .="<br />";
		$message .="<b>Sales Representative Name :</b> $salesRepresentatives";
	}
	if(strlen($logo)>0)
	{
		$finalLogo = "http://www.globaltodo.com/xmlcontact/$logo";
		$message .="<br />";
		$message .="<b>Logo :</b><br /> <img src=\"$finalLogo\" width='150' height='100' />";
	}
	if(strlen($image_1)>0)
	{
		$finalLogo1 = "http://www.globaltodo.com/xmlcontact/$image_1";
		$message .="<br />Additional Images:<br />";
		$message .="<b>Logo :</b><br /> <img src=\"$finalLogo1\" width='150' height='100' />";
	}
	if(strlen($image_2)>0)
	{
		$finalLogo2 = "http://www.globaltodo.com/xmlcontact/$image_2";
		$message .="<br />";
		$message .="<b>Logo :</b><br /> <img src=\"$finalLogo2\" width='150' height='100' />";
	}
	if(strlen($image_3)>0)
	{
		$finalLogo3 = "http://www.globaltodo.com/xmlcontact/$image_3";
		$message .="<br />";
		$message .="<b>Logo :</b><br /> <img src=\"$finalLogo3\" width='150' height='100' />";
	}
	if(strlen($image_4)>0)
	{
		$finalLogo4 = "http://www.globaltodo.com/xmlcontact/$image_4";
		$message .="<br />";
		$message .="<b>Logo :</b><br /> <img src=\"$finalLogo4\" width='150' height='100' />";
	}
	if(strlen($barcodeImage)>0)
	{
		$finalLogo5 = "http://www.globaltodo.com/xmlcontact/$barcodeImage";
		$message .="<br />Barcode Image: <br />";
		$message .="<b>Logo :</b><br /> <img src=\"$finalLogo5\" width='150' height='100' />";
	}
		
	$subjectLine = $city." city Listing Details for $businessTitle";
	
  	GENERATE_SMTP_MAIL($admin_mail_id,$admin_mail_id,"GlobalToDo",'','',$subjectLine,$message, $additionalEmailId);
	
  	echo 1;